package pos.domain;

import java.util.List;

public class EntityImpl implements Entity {
	
	private String id;
	private String name;
	private Type type; // Type of Entity given by NLP Tools
	private List<SubType> listSubType; // SubTypes given by AlchemyAPI
	private String uri; // Uri from OpenCalais
	// private List<Relation> listRelations;
	public List<String> listRDFLinks;
	
	public EntityImpl(){
		
	}
	
	public EntityImpl(String id, String name, Type type, String uri) {
		super();
		this.id = id;
		this.name = name;
		this.type = type;
//		this.listSubType = listSubType;
		this.uri = uri;
	}
	

	public String getId() {
		return id;
	}

	public String getName() {
		return name;
	}
	
	public Type getType() {
		return type;
	}

	public List<SubType> getListSubType() {
		return listSubType;
	}
	
	public String getUri(){
		return uri;
	}
	
	public List<String> getListRDFLinks(){
		return listRDFLinks;
	}

	public void setId(String id) {
		this.id = id;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setType(Type type) {
		this.type = type;
	}
	
//	public void setSubType(SubType subType){
//		this.listSubType.add(subType);
//	}
//
	public void setListSubType(List<SubType> listSubType) {
		this.listSubType = listSubType;
	}
	
	public void setUri(String uri){
		this.uri = uri;
	}
	
	public void setListRDFLinks(List<String> listRDFLinks){
		this.listRDFLinks = listRDFLinks;
	}


	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
//		result = prime * result
//				+ ((listSubType == null) ? 0 : listSubType.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + ((type == null) ? 0 : type.hashCode());
		return result;
	}


	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		EntityImpl other = (EntityImpl) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
//		if (listSubType == null) {
//			if (other.listSubType != null)
//				return false;
//		} else if (!listSubType.equals(other.listSubType))
//			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (type == null) {
			if (other.type != null)
				return false;
		} else if (!type.equals(other.type))
			return false;
		return true;
	}

	public String toString() {
		return "EntityImpl [id=" + id + ", name=" + name + ", type=" + type
				+ ", listSubType=" + listSubType + ", uri=" + uri
				+ ", listRDFLinks=" + listRDFLinks + "]";
	}

	
}
